Release 10.1A: OpenEdge Development:
Progress 4GL Reference
MATCHES operator
Compares a character expression to a pattern and evaluates to a TRUE value if the expression satisfies the pattern criteria.
Syntax
expressionA CHARACTER or LONGCHAR expression that you want to check to see if it conforms with the
pattern.patternA character expression that you want to match with the string. This can include a constant, field name, variable name, or expression whose value is a character.
The
Examplepatterncan contain wildcard characters: a period (.) in a particular position indicates that any single character is acceptable in that position; an asterisk (*) indicates that any group of characters is acceptable, including a null group of characters.This procedure displays customer information for all customers whose address ends in St. The procedure does not use an index for the customer search in
r-match.p.
Notes
- MATCHES does not use index information when performing a comparison; it always scans the entire data table.
- MATCHES does not ignore trailing blanks as does the equal (EQ) comparison operator. Thus, “abc” does not match “abc “ although they are considered equal.
- Most character comparisons are case insensitive in Progress. By default, all characters are converted to uppercase prior to comparisons. However, you can define fields and variables as case sensitive (although it is not advised, unless strict ANSI SQL adherence is required). If the
expressionpreceding the MATCHES keyword is a field or variable defined as case sensitive, the comparison is case sensitive. In a case-sensitive comparison “SMITH” does not equal “Smith”.- MATCHES converts a LONGCHAR variable value to
-cpinternalprior to comparison. The variable must convert without error, or Progress raises a run-time error.- You cannot use MATCHES to compare one CLOB field to another.
- If you want to specify a period ( . ) or an asterisk (a constant, field name, variable name, or expression whose value is character)( * ) as a literal character rather than a wildcard character in the pattern, enter a tilde (~) before the character. For example, the result of “*a.b” MATCHES “~*a~.b” is TRUE. If you specify the match pattern as a literal quoted string in a procedure file, enter each tilde as a double tilde ( ~ ~ ) so that they are interpreted as tildes for the match pattern.
- The MATCHES function is double-byte enabled. Both the specified
expressionandpatternarguments can contain double-byte characters.See also
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |